#ifndef CHEESEBOARD_H
#define CHEESEBOARD_H
#include <QtGui>
#include <QVector>
#include <math.h>
#include "mainWindows.h"
#include "CheesesProperties.h"
#include "items.h"
#include "cheese.h"
#include "masks.h"
#include "reciever.h"
#include "invoker.h"
#include "command.h"

class MainWindows;

class CheeseBoard:public QGraphicsScene
{
public:
    CheeseBoard(QObject*,int,int);
    QRectF boundingRect() const;
    void startNewGame();
    void undoAction();
    void redoAction();

protected:
    void mouseMoveEvent ( QGraphicsSceneMouseEvent * mouseEvent );
    void mousePressEvent ( QGraphicsSceneMouseEvent * mouseEvent );
    void mouseReleaseEvent ( QGraphicsSceneMouseEvent * mouseEvent );

private:
    void initCheese();
    void reset();
    bool cheeseRule(const Cheese&,const Masks&);
    bool isLegalMove(const Cheese&,const Masks&);
    bool isLegalEat(const Cheese&,const Cheese&);
    void moveCheese(Cheese*,Masks*);
    void eatCheese(Cheese*,Cheese*);
    QGraphicsView* toGetViewPort();
    MainWindows* toGetParent();

//data
private:
    int cheeseBoardWidth;
    int cheeseBoardHeight;
    int recoLocTable[row][column];
    QVector<QPointF> points; //physical pointFs
    Cheese* cheese; //found cheese
    Masks* mask; //found mask
    Items * item;
};


#endif // CHEESEBOARD_H
